Skip to content

refactor(publish): tmpdir staging + pnpm publish + publishConfig.provenance#72

Closed
John-David Dalton (jdalton) wants to merge 2 commits intomainfrom
chore/tmpdir-staging-publish
Closed

refactor(publish): tmpdir staging + pnpm publish + publishConfig.provenance#72
John-David Dalton (jdalton) wants to merge 2 commits intomainfrom
chore/tmpdir-staging-publish

Conversation

@jdalton
Copy link
Copy Markdown
Collaborator

Summary

  • Stage publishable files to os.tmpdir() via fs.cp before invoking pnpm publish. Working tree never mutates during publish; an interrupted run leaves git status clean.
  • Switch from npm publish to pnpm publish (matches the fleet's package manager). Adds --no-git-checks (staged tmpdir has no git history) and --ignore-scripts (the source's prepublishOnly guard exists to refuse direct working-tree publishes; the orchestrator already validated upstream).
  • Pin publishConfig: {access:public, provenance:true} on root so attestation is a property of the package, not a property of the workflow's --provenance CLI flag.
  • Cleanup is unconditional via try/finally + SIGINT/SIGTERM handlers feeding safeDelete() / safeDeleteSync().

Test plan

  • node scripts/publish.mts --dry-run --force produces clean dry-run output
  • Working tree stays clean throughout publish
  • Staged tmpdir is reaped on every exit path
  • CI green

Working tree never mutates during publish; the staged copy is what
`pnpm publish` runs against. Eliminates a class of "interrupted
publish leaves dirty git status" incidents:

- Run `pnpm publish:ci` against the live tree.
- Operator hits Ctrl-C mid-publish (or runner times out).
- Old behavior: tree was being modified in-place; recovery awkward.
- New behavior: tmpdir cleanup unconditional via try/finally +
  SIGINT/SIGTERM signal handlers; tree stays clean throughout.

Switches from `npm publish` to `pnpm publish` (matches the fleet's
package manager). Adds two flags required for tmpdir publishing:

- `--no-git-checks`: the staged tmpdir has no git history; pnpm's
  default would refuse to publish without one.
- `--ignore-scripts`: the prepublishOnly guard in package.json
  exists to refuse direct `pnpm publish` runs from the working
  tree. The orchestrated publish already validated upstream, so the
  guard's purpose is moot for the staged copy.

Local validated: `node scripts/publish.mts --dry-run --force` runs
through cleanly with working tree staying clean throughout.
Same shape as socket-lib + socket-tui. Pins provenance to the
package manifest so it survives any future direct publish path.
@jdalton
Copy link
Copy Markdown
Collaborator Author

Switching to direct push to main per repo policy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant